﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;

namespace AimGameEngine.NodeEditorObject
{
    partial class PropretyBoolean : Form
    {
        NodeBoolean myboolean;
        public PropretyBoolean(NodeBoolean myboolean)
        {
            InitializeComponent();
            this.myboolean = myboolean;
            this.myValue.SelectedIndex = Convert.ToInt32(myboolean.myboolean);
            this.InputMode.SelectedItem = myboolean.InputMode.ToString();
        }

        private void okButton_Click(object sender, EventArgs e)
        {
            String tempString = (String)this.InputMode.SelectedItem;
            String tempOldmode = myboolean.InputMode.ToString();
            if (tempString == AimGameLibrary.NodeInputMode.Boolean_1.ToString())
                this.myboolean.InputMode = AimGameLibrary.NodeInputMode.Boolean_1;
            else
            {
                this.myboolean.myboolean = Convert.ToBoolean(this.myValue.SelectedIndex);
                this.myboolean.InputMode = AimGameLibrary.NodeInputMode.None;
            }

            if(tempOldmode != tempString)
            myboolean.SetupProprety();
        }

        private void InputMode_SelectedIndexChanged(object sender, EventArgs e)
        {
            String tempString = (String)this.InputMode.SelectedItem;

            if (tempString == AimGameLibrary.NodeInputMode.Boolean_1.ToString())
                this.myValue.Enabled = false;
            else this.myValue.Enabled = true;
        }

    }
}
